﻿<!DOCTYPE HTML>
<html lang="zh">
<head>
<title>ListLines - 语法 &amp; 使用 | AutoHotkey v2</title>
<meta name="description" content="The ListLines function enables or disables line logging or displays the script lines most recently executed." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
<script type="text/javascript">$(function(){0<=window.navigator.userAgent.toLowerCase().indexOf("ucbrowser")&&CaoNiMaDeUc()})</script>
</head>
<body>

<h1>ListLines</h1>

<p>Enables or disables line logging or displays the script lines most recently executed.</p>

<pre class="Syntax"><span class="func">ListLines</span> <span class="optional">OnOff</span></pre>
<h2 id="Parameters">参数</h2>
<dl>

  <dt>OnOff</dt>
  <dd>
      <p>类型: <a href="../Concepts.htm#strings">字符串</a></p>
      <p>If blank or omitted, the history of lines most recently executed is shown. The first parameter affects only the behavior of the <a href="../misc/Threads.htm">current thread</a> as follows:</p>
      <p><strong>On</strong> or 1 (<a href="../Variables.htm#True">true</a>): Includes subsequently-executed lines in the history. This is the starting default for all scripts.</p>      
      <p><strong>Off</strong> or 0 (<a href="../Variables.htm#False">false</a>): Omits subsequently-executed lines from the history.</p></dd>

</dl>

<h2 id="Remarks">备注</h2>
<p>ListLines (with no parameter) is equivalent to selecting the &quot;View-&gt;Lines most recently executed&quot; menu item in the main window. It can help <a href="../Scripts.htm#debug">debug a script</a>.</p>
<p><code>ListLines OnOff</code> can be used to selectively omit some lines from the history, which can help prevent the history from filling up too quickly (such as in a loop with many fast iterations). Additionally, performance is reduced by a few percent while line logging is enabled.</p>
<p>每个新运行的<a href="../misc/Threads.htm">线程</a>(如 <a href="../Hotkeys.htm">热键</a>, <a href="../objects/Menu.htm">自定义菜单项</a>或<a href="SetTimer.htm">定时</a>子程序) 都会以此函数的默认设置开始. 这个默认设置可以通过在脚本的自动执行段(脚本的顶部) 使用此函数来改变.</p>
<p>The built-in variable A_ListLines contains 1 if ListLines is enabled and 0 otherwise.</p>
<p>On a related note, the built-in variables <a href="../Variables.htm#LineNumber">A_LineNumber</a> and <a href="../Variables.htm#LineFile">A_LineFile</a> contain the currently executing line number and the file name to which it belongs.</p>
<h2 id="Related">相关</h2>
<p><a href="KeyHistory.htm">KeyHistory</a>, <a href="ListHotkeys.htm">ListHotkeys</a>, <a href="ListVars.htm">ListVars</a></p>
<h2 id="Examples">示例</h2>
<div class="ex" id="ExBasic">
<p><a href="#ExBasic">#1</a></p>
<pre>ListLines
ListLines "Off"
ListLines False</pre>
</div>

</body>
</html>